package com.gitee.feizns.web.boot.validate;

import com.gitee.feizns.web.dao.ar.AbstractModel;
import com.gitee.feizns.web.domain.result.Err;
import com.gitee.feizns.web.mvc.validate.AbstractConstraintValidator;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author feizns
 * @since 2019/7/20
 */
@ConfigurationProperties(prefix = "validate.config")
@Data
public class ValidateProperties {

    /**
     * 验证错误消息映射
     */
    Map<String, Err> validateErrorMapping = new LinkedHashMap<>();

    /**
     * 实体验证器错误
     */
    Map<Class<? extends AbstractConstraintValidator>, Map<Class<? extends AbstractModel>, Err>> validatorEntityErrorMapping = new LinkedHashMap<>();

    /**
     * 是否自定义规则
     */
    boolean customizeErrorCode = true;

    /**
     * 最多验证的数组长度
     */
    int maximumVerificationArrayLength = 100;

}
